<template>
  <div class="viewDetail">
    <el-breadcrumb separator="/">
      <el-breadcrumb-item>首页</el-breadcrumb-item>
      <el-breadcrumb-item><a>详情</a></el-breadcrumb-item>
    </el-breadcrumb>
    <div class="content">
      <h1>{{ data.title }}</h1>
      <div class="total">
        <div class="total-left">
          <span>创建人: {{ creator.employee_name }}</span>
        </div>
        <div class="total-right">
          <i class="el-icon-view"></i>
          <span>{{ data.click_num || 0 }}</span>
          <i class="el-icon-time"></i>
          <span>{{ data.create_time }}</span>
        </div>
      </div>
      <div class="details">
        <div class="wang-editer-content" v-html="data.content"></div>
        <div class="news-form">{{ data.form }}</div>
        <div class="annex" v-if="annex.length">
          <el-row :gutter="24">
            <el-col v-for="item in annex" :key="item" :span="6">
              <file-view :fileUrl="item" />
            </el-col>
          </el-row>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import FileView from "../FileView.vue";
export default {
  components: { FileView },
  name: "viewDetail",
  data() {
    return {
      data: this.$route.query,
      creator: {},
      annex: [],
    };
  },
  mounted() {
    if (!this.data.creator.employee_id) {
      this.data = JSON.parse(
        sessionStorage.getItem("viewData", JSON.stringify(this.data))
      );
      this.creator = this.data.creator;
      this.annex = this.data.annex_url.split(",");
    }
    this.creator = this.data.creator
    sessionStorage.setItem("viewData", JSON.stringify(this.data));
  },
  methods: {},
};
</script>
<style lang="less" scoped>
.viewDetail {
  width: 100%;
  .content {
    padding: 34px 74px 24px;
    background-color: #fff;
    border-radius: 8px;
    h1 {
      font-weight: 600;
      font-size: 24;
      text-align: center;
      margin-bottom: 12px;
    }
    .total {
      color: #999;
      font-size: 14px;
      display: flex;
      justify-content: space-between;
      border-bottom: 1px solid #dee0e3;
      line-height: 40px;
      .total-right {
        span {
          padding: 0 30px 0 10px;
        }
        &:last-child {
          padding-right: 0;
        }
      }
    }
    .details {
      .wang-editer-content {
        padding: 24px 0;
        border-bottom: 1px solid #dee0e3;
      }
      .annex {
        margin-top: 24px;
      }
    }
  }
}
</style>
